"""
 -*- coding: utf-8-*-
 @File: page_home.py
 @Author: chen
 @time: 2023/10/04/ 19:33
"""
import allure
from appium.webdriver.common.appiumby import AppiumBy

from hogwartsHomework.homework_app_auto_L3.dev.pages.page_base import BasePage
from hogwartsHomework.homework_app_auto_L3.utils.mgt_log import logger
from hogwartsHomework.homework_app_auto_L3.utils.mgt_yaml import MgtYaml


class HomePage(BasePage):
    def goto_contact_list(self):
        """点击通讯录按钮，进入通讯录页面"""
        button_contact_list = (AppiumBy.XPATH, '//*[@text="通讯录"]')
        with allure.step("点击通讯录按钮"):
            logger.info("点击通讯录按钮")
            # self.wait_until_clickable(button_contact_list)
            self.do_click(button_contact_list)
        from hogwartsHomework.homework_app_auto_L3.dev.pages.page_contact_list import ContactListPage
        logger.info("进入通讯录页面")
        return ContactListPage(self.driver)


if __name__ == '__main__':
    cur_page = HomePage()
    cur_page.goto_contact_list()
